//柯里化案例

const _ = require("loadsh");

const match = _.curry(function (reg, str) {
  return str.match(reg);
});

const haveSpace = match(/\s+/g);
const haveNumber = match(/\d+/g);
// console.log(haveNumber("hellow word"));
// console.log(haveSpace("hellow word"));

const filter = _.curry(function (func, array) {
  return array.filter(func);
});
console.log(filter(haveSpace, ["john connor", "john_Donne"]));
const findSpace = filter(haveSpace);
console.log(findSpace(["john connor", "john_Donne"]));
